/* IE7/IE8.js - copyright 2004-2008, Dean Edwards */
(function() {

    window.hasOwnProperty = window.hasOwnProperty || function(key) {
        return Object.prototype.hasOwnProperty.call(window, key);
    };

    if (!Array.prototype.indexOf) {
        Array.prototype.indexOf = function(elt /*, from*/ ) {
            var len = this.length >>> 0;
            var from = Number(arguments[1]) || 0;
            from = (from < 0) ? Math.ceil(from) : Math.floor(from);
            if (from < 0)
                from += len;
            for (; from < len; from++) {
                if (from in this &&
                    this[from] === elt)
                    return from;
            }
            return -1;
        };
    }

    String.prototype.trim = function() {
        return Trim(this);
    };

    function LTrim(str) {
        var i;
        for (i = 0; i < str.length; i++) {
            if (str.charAt(i) != " " && str.charAt(i) != " ") break;
        }
        str = str.substring(i, str.length);
        return str;
    };

    function RTrim(str) {
        var i;
        for (i = str.length - 1; i >= 0; i--) {
            if (str.charAt(i) != " " && str.charAt(i) != " ") break;
        }
        str = str.substring(0, i + 1);
        return str;
    };

    function Trim(str) {
        return LTrim(RTrim(str));
    };
})();

